This is called pupillometry and it isn't just limited to adjustments to light. Pupils also dilate when a person is anxious, excited, and working on math problems!
In fact, the pupil serves as a sensitive indicator of cognitive, emotional, and sensory responses in psychological research. The eyes really do serve as windows to the soul or at least the brain. For more details on pupillometry, check it out.