All the answers you’ve had so far have been Modern Greek.
Dimitri Leeberakees has the cleverest Modern Greek answer, which references the proverbial expression το πάθημα μάθημα (often expanded to το πάθημα ας γίνει μάθημα). μάθημα is “lesson”. πάθημα is “suffering”, or “something that happens to you”, although in Modern Greek it is most used in order to rhyme with μάθημα. So “the suffering [or: the thing that happened to you]—a lesson”. Or more expansive, “may the suffering become a lesson”.
For Ancient Greek pretty much the same expression occurs in Aeschylus: πάθει μάθος “in suffering, learning”. There is a rhyming version: πάθος μάθος “suffering, learning” i.e. “suffering is learning”.
The similarity between the ancient and modern expressions is likely not a coincidence.
“Never a failure, always a lesson” in Ancient Greek? ἀμάρτημα, ἁμαρτία is “fault, failure”—and in Christianity, “sin”. ἀστοχία is “failure” as in “missing a target”. πταῖσμα is “stumble, misstep, error”—and in Modern Greek, misdemeanour.
I think I’d like to play with ἀστοχία, and make up an archery thing: οὔποτ’ ἀστοχία ἀλλὰ γυμνασία. “It’s never failure [missing the mark]: it’s exercise/practice”.
But you know, πάθος μάθος is the best choice.