This usage of dative case is called »Dativ der Beteiligung« ("dativ of participation" or as latin term: dativus commodi). It determines someone who is affected by the action. It marks the beneficiary or aggrieved party.
Die Sonne scheint aus den Augen.
The sun is shining out of the eyes.
Note, that this sentence doesn't tell to whom the eyes belong. Now we use meinen:
Die Sonne scheint aus meinen Augen.
The sun is shining out of my eyes.
Here we say clearly, that the eyes belong to me. It's my eyes from where the sun is shining out of.
But this is different:
Die Sonne scheint mir aus den Augen.
The sun is shining out of the eyes, and I am the beneficiary or aggrieved party of this shining.
Note, that here again the grammar makes no statement about the ownership of the eyes. The grammatical construction is just talking about any eyes, they might be anybodies eyes. But the grammatical construction says: I am affected by the action that is going on in this sentence. The sun is shining out of me.
In the case of body parts both constructions mean the same on a semantic level, because you never can have eyes in your head that are not yours. So it must be your eyes.
But in a different setting this can make a different meaning:
I don't own a car. But I have a driving license and I can ask a friend to lend me his car. I do so, and drive. I stop at a traffic light and then a truck crashes from behind into the car that I am driving, but which is not my car. Now I can say:
Der LKW ist mir ins Auto gekracht.
The truck chrashed into the car, and I am the aggrieved party.
But this would be wrong, because the car is not mine:
Der LKW ist in mein Auto gekracht.
The truck chrashed into my car.
Back to the shiny eyes:
Of course you can combine mir (who is affected?) and meinen (who is the owner?):
Die Sonne scheint mir aus meinen Augen.
The sun is shining out of my eyes, and I am the beneficiary or aggrieved party of this shining.
And of course you can use this kind of dative also for other grammatical persons (not just only for 1st person):
Barbara ist eine sehr hübsche Frau. Die Sonne scheint ihr aus den Augen.
And again the truck-crash:
Ich hoffe, dass dir nie ein LKW ins Auto kracht.
I hope, that you never are affected by a truck crashing into the car. (I am worried about you.)
Note, that this is different from:
Ich hoffe, dass nie ein LKW in dein Auto kracht.
I hope, that never a truck crashes into your car. (I am worried about your car.)
A question from a comment was:
Die Sonne scheint mir aus den Augen.
The sun shines upon me from the eyes, and i am victim/aggrieved party/beneficiary.
No. You can't say "the sun is shining on/upon me" using dative case in German. You need a preposition and a personal pronoun in accusative case for this. And if you use accusative case for a part of speech, you can't use dativus commodi at the same time for the very same part of speech.
"The sun shines upon me from the eyes" is:
Die Sonne scheint auf mich von den Augen.
or (better word order)
Die Sonne scheint von den Augen auf mich.
You also might say
Die Sonne scheint auf mich aus den Augen.
Die Sonne scheint aus den Augen auf mich.
because it has a very similar meaning (aus den Augen = out of the eyes; from the eyes = von den Augen)
But you can say this:
Die Sonne scheint mir auf den Kopf.
literally: The sun is shining on the head, which affects me.
usual translation: The sun is shining on my head.
Note, that here the sentence doesn't tell that the beam of light hits you. This sentence says: The light is shining on a head. But the sentence doesn't tell you who's head this is. It says nothing about the ownership. But the pronoun in dativus commodi tells you who is affected by this action. It says: the speaker of this sentence is affected. Everything else is no longer encoded directly in the grammar.
As said before: When talking about body parts there is no difference in meaning on a semantic level. The sun is shining on the speakers head. But a very important information to get to this knowledge is not included in the German sentence. It is the information, that everybody has just one head that can not be changed. For body parts this is always true, so for body parts »mir auf den Kopf« and »auf meinen Kopf« always lead to the same meaning. But for anything else, where owner and beneficiary can be different, there are different meanings.
But again: »The sun is shining on me« can not be said in German using dativus commodi.
This all is possible:
Die Sonne scheint mir auf den Bauch.
The sun is shining on the stomach and I am affected.
Die Sonne scheint mir in die Wohnung.
The sun is shining in the apartment and I am affected.
The sun is shining upon me.
Die Sonne scheint auf mich.