Philipp explained the mechanics well, so I'll skip to how you can get it back to its original de jure land if that's what you want to do. Ultimately, for land to drift back into the kingdom the following conditions have to be met:
1. The full duchy must be owned (either as demesne or through vassals) by one realm.
2. The owner's liege cannot own the de jure title of the land (in your case, the Kingdom of Andalusia).
Since your character is a King, you'll have to decide whether you will become an emperor or give up the land to vassals. Both have different risks in terms of getting the land completely back to normal, but both will probably at least allow you to get the titles back to being landed.
If you decide to become an Emperor, you'll need to give the original land of the Kingdom of Andalusia to one vassal, and only that land (at least in Iberia). Do the same for all the titular Kingdom titles. At this point, you can leave it alone and if nothing happens, the land will drift back in one hundred years, however, the owner of the Kingdom of Andalusia will have a de jure claim on all the other land in Iberia, so he may decide to fight for what is his. If you do not have Absolute Crown Authority, there isn't much you can do about this besides combining a few of the smaller northern Kingdoms so their owner can go toe to toe with Andalusia.
If you decide to remain a King, you'll need to do effectively the same as the above, but when you give the Kingdom title to your vassals they will no longer be your vassals. The one advantage of this is that you can set it up so you are allies with all Kingdoms but Andalusia and always join with the defender when they fight each other until the de jure drift finishes, effectively serving as a peacekeeper.