There is no public transportation from Dakhla to Mauretania, the Hotel Sahara near the Souk offers a shared taxi to Nouadhibou for 300 Dirham and to Nouakchott for 600 (7 am, 10 hours drive and 2 hour waiting at the border).
Supratours (close to hotel Sahara, 150 Dirham) would have a bus at midnight to the Moroccan border (returning maybe after 6 pm) but you have to walk then about 3 km throu no man's land and in the Mauritanian side i did not see a bus, but if you wait there will be a shared taxi leaving when full.
Dakhla does not have a bus station, which means you have to ask around for offices of the various bus companies around town. Supratours, SATAS and SAT all have offices close to the new mosque, but CTM has an office out of town where the bus will drop you off, and an office in the town centre by the budget hotels where you can pick up the bus. Services leave Dakhla for Agadir and Marrakesh, although you'd have to be quite hardcore to stay the length, as it takes 24 and 30 hours to reach those destinations. The buses all pass through Boujdour (6 hours), Laayoune (9 hours), Tan Tan, Guelmim/Goulimime, Tiznit and Inezgane. I did the journey up as far as Laayoune, after which I'd really had enough. Buying tickets in advance isn't really essential, as not that many board the bus in Dakhla, and people boarding at later stops can't buy tickets until the bus arrives, so there's plenty space on board.
To Laayoune, you have the choice of travelling overnight, or taking a morning bus. I'd probably recommend taking a day bus in at least one direction, so you can at least have a look at the Sahara (if you're coming all the way to Dakhla, let's face it, that's what you've come to see!). The secenery en route isn't really that exciting, and for hours on end it is actually very boring. However, you do get to see remote fishing communities occasionally, tiny uninhabited villages that the Moroccan government has built in advance of the referendum on Sahraoui independence, some stunningly wild beaches, and the odd herd of camels grazing in the middle of nowhere. Another advantage is that you will not have to be woken up at every police checkpoint...as a foreigner, you'll be taken off the bus and asked lots of questions (passport number, job, nationality, reason for travel, father's name, favourite colour, that sort of thing...). There are about 5 checkpoints between Dakhla and Laayoune, and you can try to speed up the process by having sheets prepared with answers to any possible question, but despite my efforts, it didn't really do much good. Just be friendly and patient, and the police will be the same.
Buses don't have toilets on board, but there are two stops on the way at service stations 9be warned, one is quite basic in the toilet department), and if you're desperate, I'm sure nobody would mind if you had a quick pee in the desert at one of the checkpoints!
There are also shared taxis from Dakhla to Boujdour and Laayoune, but you'd have to be either masochistic or very small to consider these. Flights also leave for several Moroccan cities and Las Palmas.
Some photos taken from the bus...