This video describes how energy is converted from mechanical energy to electrical energy.
Th below video describes how energy is conserved in newton's cradle