Both the music examples are incorrect.
In the first, the two Ds on the top staff don't line up vertically with the D on the bottom staff. The player might wonder if the top staff D-G-A was intended to be a triplet, or something similar, starting after the left hand D.
In the second, there is nothing to say when the G on the top staff is supposed to be played (though in this example it's fairly obvious what was intended). There should be another 8th-note rest, to count the correct number of beats in the bar.
If those things are corrected, there is a difference in meaning between them. In the first one, the "tune" starts with the D. In the second one, the D is part of the accompaniment (and would probably be played softer, even though no dynamics are marked) and the "tune" starts with the G.
If the piece was a real song, originally with lyrics, obviously only one of those two options could be the correct one. In the other, the words wouldn't fit correctly to the notes.