Although it's actually more complicated, because there's more than one Russian translation, and this problem was tackled in different ways. Lermontov just did a straightforward translation, changing the implied meaning. Tutchev and Fet both changed the pine to another tree such that the word is male: cedar or oak (in the latter case, this also required changing the described environment in which it grows).
https://ru.wikisource.org/wiki/%D0%9D%D0%B0_%D1%81%D0%B5%D0%...
In Russian, both words are female.