Yoda would likely have been a better teacher than Obi-Wan, but Anakin probably still would have turned to the dark side.
As @NikolaiDante pointed out Yoda has much more experience training Jedi than Obi-Wan, and Obi-Wan had just barely achieved Jedi Knighthood when Anakin became his Padawan. In that sense, Yoda certainly would have been a better teacher.
However, we saw Yoda counsel Anakin on his visions of Padme's death in childbirth, and his advice was extremely poor given Anakin's circumstances (Padme was already pregnant, and Anakin knew it):
YODA: Premonitions . . . premonitions . . . Hmmmm . . . these visions you have . . .
ANAKIN: They are of pain, suffering, death . . .
YODA: Yourself you speak of, or someone you know?
ANAKIN: Someone . . .
YODA: . . . close to you?
ANAKIN: Yes.
YODA: Careful you must be when sensing the future, Anakin. The fear of loss is a path to the dark side.
ANAKIN: I won't let these visions come true, Master Yoda.
YODA: Death is a natural part of life. Rejoice for those around you who transform into the Force. Mourn them, do not. Miss them, do not. Attachment leads to jealousy. The shadow of greed, that is.
ANAKIN: What must I do, Master Yoda?
YODA: Train yourself to let go of everything you fear to lose.
Star Wars: Episode III Revenge of the Sith
In Yoda's defense, Anakin did not tell Yoda that his premonitions involved the death of his wife in childbirth. Nonetheless, given Anakin's circumstances Yoda's advice was incredibly insensitive -- he literally told Anakin to "rejoice" that his wife (and possibly child) would die in childbirth.
Yoda's advice was probably a factor in Anakin's decision to turn to the dark side: the Jedi (via Yoda) were essentially telling him to "be happy" about his wife's death, whereas the Sith (via Palpatine/Sidious) were offering him a chance to save her.
The only way I think Yoda might have prevented Anakin's turn to the dark side would have been if Yoda had managed to better teach Anakin why the Jedi are forbidden from attachments before Anakin and Padme became romantically involved. But once Anakin and Padme's relationship turned romantic, it was too late for the Jedi to tell Anakin to avoid attachment and "rejoice" at the deaths of loved ones. Furthermore, since Yoda was oblivious of Anakin's marriage I don't know if Yoda would have been able to prevent Anakin from starting a romantic relationship with Padme.
In short: Yoda would have been a better teacher than Obi-Wan because he had more experience in training Jedi, but that likely would have made no difference in preventing Anakin from turning to the dark side. Since the outcome would have been the same (Darth Vader), it's a moot point.