Do you use a Japanese IME? It can convert hiragana to ordinary mixed-kanji-kana sentences, although it sometimes make mistakes. Jisho.org does a similar thing, but in the opposite direction.
This can be achieved by programs called morphological analyzers. MeCab is one of the best-known, but there are other open-source software. The technical details are beyond the scope of this site, but this is a technically challenging problem, and recent ones generally use large dictionaries and machine learning. Here's an example output of kuromoji:
There are a few words that are read differently in different contexts. For example, 人気 is read either ひとけ or にんき depending on the context. (English also has the same problem; read, wind and minute have multiple possible readings.) Recent good morphological analyzers may handle even cases like this, but the one implemented in jisho.org does not seem to be smart enough to me.
See also: