For the Allied side, we had the Commonwealth War Grave Commission, who were responsible for burials and cemeteries, as well as maintaining them to this day. It was a collossal investment at the time, and we hadnt done anything like it before. Especially with the policy of them all being buried equally. People who were executed from crimes were buried alongside those who died in battle, with nothing to mark them as being executed (it was seen as they've already had their punishment, no need to punish them for it after their death too). None were taken back to the UK, no families allows to bring them back (as only the rich could afford it, and it was seen as unfair to allow the rich to have a funeral with their sons boy when the poor couldnt). There's even the grave of a British Prince over there, not even in the main military cemetary (that one was combined with a civilian one).
The land was donated by France or Belgium (CWGC cemeteries have plaques on the wall saying how the land is given in perpetuity as a resting place for the dead), and the dead were either left where they were and headstones placed where simple wooden crosses had been before, or they were moved to larger cemeteries like Tyne Cot. If you look at an Ariel map of Tyne Cot, you can see the original graves as a loosely organised gaggle in the middle, and the imported graves neatly lined everywhere else.
They tried to keep the bodies where they fell though. One cemetery that's hidden in some woods I've been to has a sign saying that 'the Devonshire's held this trench, and the Devonshire's hold it still' as they were buried in the trench they died in. Link here.
Imgur album of what they look like: http://imgur.com/a/gD96R
The other side fared less well. Whilst there are a few German cemeteries in Belgium from WW1, they often feature mass graves, as the Belgians were unwilling to give large amounts of land to those who had attacked them. Germany was told they could pay to take the bodies back to Germany (an expensive process the bankrupt Germany couldnt afford) or have them buried in these mass grave style cemeteries. Langemark is a great example if you want a look at what they're like.
Stones: http://imgur.com/Fk8xlOK, http://imgur.com/KGwpdlC
The number of people buried under each one: http://imgur.com/iosghO3
The top of the vault where ~25,000 germans were buried: https://imgur.com/gEHBzFF
Stones around the vault with the names of those buried there: http://imgur.com/gI3xpvi