The second interpretation is not very likely in this particular example because 先生から授業がない makes little sense. That idea would probably be expressed as 先生の授業がない.
先生から授業がある works better.
先生から今日は授業があると聞いたんだけど。
This could be translated in two ways.
- I heard from the teacher that there will be a class today.
- I heard that the teacher will give (us) a class today.
However, without enough context, the second interpretation is still less likely than the first. That’s because of 今日は. It is clearly part of the quotation. If 先生から is also part of the quotation, it would most likely be placed after 今日は.
今日は先生から授業があると聞いたんだけど。
But this makes the first interpretation much less likely (unless, of course, 今日は is a worthy topic of the whole sentence).
If you take out 今日は altogether, the sentence becomes more context-dependent.
先生から授業があると聞いたんだけど。
This could go either way.
If you need to make it clear that you heard the news from the teacher, you can say:
授業があると先生から聞いたんだけど。
This completely disambiguates the meaning.
So, it depends on word order and context.
[EDIT]
Although it’s definitely much better than 先生から授業がない, even 先生から授業がある sounds a bit awkward. I guess 授業 is not the kind of noun that makes you think of its direction, which から indicates, especially when it’s not given. 〜から〜がない works better with some other nouns. For example, 先生から説明がない sounds as natural as 先生から説明がある.
授業があるliterally means “there is a class” and this itself has no concept of direction. However, when you hear it, you create a mental image where someone is teaching something to a group of people, and this idea could be expressed with から as you see something move from one point (the teacher) to another (the students). This doesn’t work when there is no class. You would only think of a vacant classroom. 説明, on the other hand, directly refers to the thing that moves from one point to another (if given), rather than a setting like 授業 where such a movement might happen. – aguijonazo Jun 18 '21 at 01:38先生から聞いたと聞いた, から would be associated with the first 聞いた, because it’s closer, unless the context suggests otherwise. – aguijonazo Jun 19 '21 at 09:52