To add to J.A Streich's answer:
The table from the DMG corresponds to the stat progression from the leveling tables.
If we assume that a caster starts with a 151 in their primary casting stat during character creation and then adds +1 or +2 from racial bonuses, they'll end up with +3 to that stat at level 1.
If we also assume they increase that stat by +2 each time they get an ability score improvement, they'll end up with a spellcasting bonus identical to the "attack" bonus on the table from the DMG:
\begin{array}
{|c|c c c|c|}
\hline
&\color{gray}{Stat}&&Total&\color{purple}{Highest}\\Lvl &\color{gray}{Mod} & \color{gray}{Pro} & Mod &\color{purple}{Slot\ ^2} \\ \hline
1 & \color{gray}{+3} & \color{gray}{+2} & +5 & \color{purple}{1} \\ \hline
2 & \color{gray}{+3} & \color{gray}{+2} & +5 & \\ \hline
3 & \color{gray}{+3} & \color{gray}{+2} & +5 & \color{purple}{2} \\ \hline
4 & \color{gray}{+4} & \color{gray}{+2} & +6 & \\ \hline
5 & \color{gray}{+4} & \color{gray}{+3} & +7 & \color{purple}{3} \\ \hline
6 & \color{gray}{+4} & \color{gray}{+3} & +7 & \\ \hline
7 & \color{gray}{+4} & \color{gray}{+3} & +7 & \color{purple}{4} \\ \hline
8 & \color{gray}{+5} & \color{gray}{+3} & +8 & \\ \hline
9 & \color{gray}{+5} & \color{gray}{+4} & +9 & \color{purple}{5} \\ \hline
10 & \color{gray}{+5} & \color{gray}{+4} & +9 & \\ \hline
11 & \color{gray}{+5} & \color{gray}{+4} & +9 & \color{purple}{6} \\ \hline
12 & \color{gray}{+5} & \color{gray}{+4} & +9 & \\ \hline
13 & \color{gray}{+5} & \color{gray}{+5} & +10 & \color{purple}{7} \\ \hline
14 & \color{gray}{+5} & \color{gray}{+5} & +10 & \\ \hline
15 & \color{gray}{+5} & \color{gray}{+5} & +10 & \color{purple}{8} \\ \hline
16 & \color{gray}{+5} & \color{gray}{+5} & +10 & \\ \hline
17 & \color{gray}{+5} & \color{gray}{+6} & +11 & \color{purple}{9} \\ \hline
\end{array}
1 Using a standard array or point buy with the upper limit capped at 15
2 Compare to the spell scroll level
The caveats:
If a character gains a magic item, it would boost their casting mod sooner than what's listed on the table (ceteris paribus).
Likewise, if a character takes a feat instead of boosting their stat, they will be "behind the curve" (ceteris paribus).