The way I was instructed on Buddhism is very different from the perspective implied in most of the answers and in the question itself. My teacher(s) would probably say this misunderstanding comes from a deeply ingrained materialistic view.
From (right) Buddhist perspective, the five senses, plus the sense of introspection - are all mind faculties. They are differentiated by six modalities, but they are all faculties of the mind. To say that the world exists "outside" and the mind sits "inside" and perceives the world through the little holes is a (wrong) materialistic perspective. The world exists inside. The mind exists outside. There is no inside and outside.
When we're dreaming, we experience "a world" on the same five modalities, and we experience "self" on a sense of introspection - but this world and this self is not the same we experience when awake. Why? Because our state of mind is different. State of mind defines what we experience and how we experience it.
When Buddha talks about "contact" - he does not talk about an external object touching a sense organ. First of all, with the exception of taste, objects almost never actually "touch" our sense organs. The stimuli we do get are mere reflections of object's properties in either light-waves or sound-waves or its emission of chemical molecules (in case of smell). Even the sense of touch is usually mediated. When we feel the ground with our feet through the soles of our shoes, or even better - when we feel the surface of the road with the wheels of our car - the object never touches our body and yet we feel it. So the stimulus is not the object, the object is a construct of our mind based on the stimulus.
When Buddha talks about "contact", he talks about contact in our experience. Our constructed idea of self comes in touch with our constructed idea of object. This is called "contact". It happens in our imagination, whether we're dreaming or awake. In all cases the object is a projection of our mind.
-- "My question is: due to coming together of which internal and external does the dream arise? Due to which contact in this real world?
This idea of "external" and "internal" with the doors of senses in-between is a very materialistic idea. Also, there is no "real world", it's an experience, projection, imagination. My Zen Master called it "hallucination"!
As all experience (vijnana), dreaming arises from samskara. Then, "inside" that experience, there is "internal" and "external", "contact", "objects", "self" and "the world". All experience is constructed by the mind, including eye-experience, ear-experience etc. - both when dreaming and when awake.