People who take longer to enter the dream stage of the sleep cycle are more likely to develop dementia, suggests a new study.