Depending on how far down the rabbit hole you want to go, you could take several interpretations.
Philosophical Nature of Reality
How do we define what is true? Descartes's famous Discours de la Méthode discusses how reality is defined entirely by what we perceive. He eventually rejects the idea of reality truly being subjective, possibly all artificially generated by some demon that makes us hallucinate what we think of as real, with her statement of Cogito ergo sum, "I think; therefore I am". On one level, Harry's dream of the train station is his perceptions. Thus, it is his reality of the time.
Dream Interpretation of Outside Perceptions
I believe this is what Rajan is referring to in his answer, that Harry may be taking what he knows happened before he became unconscious, and interpreting the additional sensory information he is passively receiving in a way that makes internal sense as a dream scene. This is the sort of thing that many people experience where their alarm going off in real life becomes a fire siren or a bomb about to explode in their dreams.
A Wizard Did It
No, not necessarily Dumbledore. I'm alluding to the TV Tropes entry where pretty much anything can be dismissed by saying it's magic. We could just take the easy way out here and answer your question by wiggling our fingers and saying mysteriously, "magic.."
The Butler did it... er, I mean Dumbledore did it
Dumbledore may truly be not only dead, but really most sincerely dead. That said, there are many ways in which wizards survive on after death in this world. Portraits, photographs, horcuxes, ghost, priori incantatem apparitions, pensieve memories... those are all canonical ways in which someone who is dead (mostly dead in the cases of the horcrux diary) can appear with seeming sapience. This isn't even getting into factors such as Dumbledore having a twin brother whose blood he likely shares (twins being highly genetically similar). So, this might be Dumbledore actually inside of Harry's head. It's in his head, but it's real.
Personally, I tend toward the third theory. Rowling didn't have any great meaning. She didn't intend this to be some sign of Dumbledore's contingency plans. Rather, she had the scene she wanted to write and she wrote it, and when people ask how it works, she wiggles her fingers and whispers, "Royalty checks..." Er, I mean, she wiggles her fingers and whispers, "Magic..."