The first says that what some people may see as ending something can be seen as a beginning for others. Caterpillars end their existence as pupae; butterflies begin their existence from pupae.
The second indicates that experiencing disappointment teaches a person how to be patient and learn from experience.
The proverb is "Necessity is the mother of invention".
Student or Learner