While getting from Morocco to Mauritania is quite problematic (you will need your own transport, a permission, and you will have to travel in a convoy that heads south twice a week from Dakhla), it is still the only way of getting anywhere south of Morocco by overland transport, and at the presetn also the best way of crossing the Sahara desert from anywhere in North Africa.
Going back to Morocco, from Nouadhibou in Mauritania, is judged as illegal by Mauritanian authorities, but is still being done by many travellers. Special guides are often needed, and the border crossing is normally done during the night. As there is a number of landmines in the region, Mauritanian police (which is divided into those fining you, and those waiting for a bribe) is the smaller of the hazards. Back in Morocco, you risk being detained for a couple of days, but I have been told that there are Western travellers that are fascinated by the illegality of this, since there is little to fear from the way the "prisoners" are treated.
As you have crossed the border into Morocco, there is only one settlement within reach: Dakhla, 350 km to the north, since La Gouera is effectively set under Mauritanian administration.