Drupal - Get taxonomy terms

Replacing a deprecated function is in most cases trivial. Just look at it. There you can see this:

\Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadTree($vid, $parent, $max_depth, $load_entities);

If you are looking for a function that was already removed, search for it on Change records for Drupal core page. Pretty much every function that was removed should have more or less (usually more) detailed instructions on how to do it in Drupal 8 instead.

The storage class is an entity storage handler, that you get through the entity manager. In general, 99% of the classes in D8 are not meant to be created yourself, but as a service, or entity handler, plugin.

For example:

$vid = 'vocabulary_name';
$terms =\Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadTree($vid);
foreach ($terms as $term) {
 $term_data[] = array(
  'id' => $term->tid,
  'name' => $term->name
 );
}

This is what I use to create a list of tags:

  use Drupal\taxonomy\Entity\Term;      
  use Drupal\Core\Link;
  use Drupal\Core\Url;

  $vocabulary_name = 'YOUR_VOCABULARY_NAME'; //name of your vocabulary
  $query = \Drupal::entityQuery('taxonomy_term');
  $query->condition('vid', $vocabulary_name);
  $query->sort('weight');
  $tids = $query->execute();
  $terms = Term::loadMultiple($tids);
  $output = '<ul>';
  foreach($terms as $term) {
      $name = $term->getName();;
      $url = Url::fromRoute('entity.taxonomy_term.canonical', ['taxonomy_term' => $term->id()]);
      $link = Link::fromTextAndUrl($name, $url);
      $link = $link->toRenderable();
      $output .='<li>'.render($link).'</li>';
  }
  $output .= '</ul>';
  print $output;

If you need term entity, you can use 'loadByProperties()'.

$vid = 'vocabulary_name';
/** @var \Drupal\taxonomy\Entity\Term[] $terms */
$terms =\Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadByProperties(['vid' => $vid]);