It's both. Sleep is when trained skill get delegated into the muscle memory. Not sure if it relates to dreaming.
https://en.wikipedia.org/wiki/Muscle_memory#Sleep_effects_on...