Because text is extremely complicated, there is no perfect answer to this question, but without writing an essay about descenders and base lines and other stuff you probably don't care about...
As far as I know, in SFML there's simply no way to go from a desired pixel width/height to its closest characterSize. I believe this is because fonts are simply too complicated for such a thing to be possible in the first place, but someone else will have to confirm that. So you're going to have to write some "guess and check" code.
I can think of three parts of the SFML API that you can play the guess and check game with: First, sf::Font::getLineSpacing(), which is probably the simplest option if you mostly care about the height. Second, sf::Text has getLocalBounds() and getGlobalBounds() methods. Third, you could use sf::Font::getGlyph() to get the bounding rectangles for every glyph in your string and add up their widths and heights.