The first clause is a condition for the second. It's the same as "If you show you really want to learn, your teacher won't get angry."
I wrote something about this a while ago:
"By + [adj. verb phrase], [statement]. = The [statement] occurred, because the [adj. verb phrase] did.
By running frequently, you can get fit quickly.
By carefully and intelligently managing our assets, we improved our finances by over 60%.
By doing something, something far more dramatic happened.
By trying to think of examples using the word 'by', I completely exhausted my imagination."