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://de.wikisource.org/wiki/Ein_Fichtenbaum_steht_einsam
Now try translating this to a language where the tree names are gendered differently, such that e.g. both are male, or both are female.