How does generateFromLink work?
You shouldn't use this service because it is marked as internal and you shouldn't use any other method to generate links in custom code. Generating a link is like early rendering. See https://www.lullabot.com/articles/early-rendering-a-lesson-in-debugging-drupal-8
Instead add the link as render element to the build array.
Like this examples which also demonstrates how you can build nested render elements, here an image as link title:
      $link_title = [
        '#theme' =&gt; 'image',
        '#uri' =&gt; $image,
        '#alt' =&gt; $label,
      ];
      $image_link = [
        '#type' =&gt; 'link',
        '#title' =&gt; $link_title,
        '#url' =&gt; Url::fromUri($link_href),
        '#options' =&gt; [
          'attributes' =&gt; ['class' =&gt; ['feed-image']],
        ],
      ];

      $build[$id]['image'] = $image_link;

Example from /core/modules/aggregator/src/FeedViewBuilder.php