Another way to say "sleeping is for dreaming" is "Dreaming is one of the functions of sleep."