Comparing between SN2 and E2
The most important factor in these reactions are nucleophiles. Here, the use of strong base (Sodium methoxide) in both of the reactions favors the bi-molecular mechanisms ($\ce{S_N2}$ and $\ce{E2}$). 

Now, the second factor would be degree of halogen-linked carbon. Lower degree carbons ($\ce{\text{deg.} &lt; 2}$) favor $\ce{S_N2}$, while higher degree favors $\ce{E2, E1, S_N1}$. So, $\ce{S_N2}$ is favored in first and $\ce{E2}$ in second. 

Temperature conditions and nature of solvent are least important factors, and should be looked up when above two factors are similar.