These two quotes from The Little Prince, translated from the French, are examples of metaphor. A metaphor is a literary device defined by one object figuratively being compared to another—similes are specific kinds of metaphors that make this comparison using the words "like" or "as." Neither of these examples is a simile.
In the first quote, time is compared to an object flying by. An object that is flying is (usually) moving very quickly, so the metaphor communicates that time is also moving very quickly: almost too fast. The advice offered by the metaphor not to cry or be upset by the rapid, incessant passage of time. Instead, it urges us to accept life for what is.
The second quote is also a metaphor. The sound of the stopping train is compared to a loud roar—such as an animal like a lion might make. This conveys the amount of noise the stopping train makes in vivid terms and constructs a clear image of the power that the train has.