In my opinion, no.
I think the two are linked, or associated, but not tightly. That is, greatness--in the senses of excellence, depth, originality, substance--is often associated with greatness because (some) people do recognize these things, and are drawn by them and inspired by them. Many of the canonical 'greats' of the past enjoyed considerable popularity--Shakespeare, Beethoven, Dickens and Picasso might be cited as examples.
But popularity can also arise from shallower or ephemeral causes, sometimes. (I'm not naming any names here!)
And sometimes, a 'great' can be largely unknown or unrecognized during life--Van Gogh, geneticist Gregor Mendel and poet/artist William Blake could be cited. This is often the case where an artist (or scientist, even) is in some way not in sympathy with the mainstream of the day in his or her field.
Mendel, for instance, did a very tight and elegant quantitative study of the heritability of various characteristics of pea plants, whereas biology in his day tended to be more verbal, descriptive and all-encompassing. The precision and discernment of his work was missed. Blake, similarly, was 'wild' and 'rough'--to his contemporaries, even 'mad.' His originality and transcendent vision were much more congenial to his Romantic successors than to his contemporaries; the most glowing recommendation they had to offer him was probably Fuseli's accolade that he was "damned good to steal from."
In my opinion, a true mediocrity rarely gains the heights of popularity--or not for long, anyway.