When a person has dreams, the pupils can "follow" what is happening.
When they don't, the pupils are in the middle, because other positions are possible only with the tension of certain muscles.
In a sleeping person, the eyes roll upward - accordingly, the pupils are directed to the region of the eyebrows. By the way, putting your eyes in this position is one of the ways to quickly fall asleep. It is advisable to use it in conjunction with other methods - relaxing the body, emptying the head, etc. But that's another question.