To solve this problem, we start by noting that the amount of water \( W \) is directly proportional to the amount of ammonia \( A \). This can be expressed mathematically as:
\[ W = kA \]
where \( k \) is the proportionality constant.
From the information given, when there are 5 gallons of water, there are 10 teaspoons of ammonia. We can use this information to find \( k \):
\[ 5 = k \cdot 10 \]
From this equation, we can solve for \( k \):
\[ k = \frac{5}{10} = 0.5 \]
Now that we have the value of \( k \), we can determine how many gallons of water are needed for 25 teaspoons of ammonia. We use the formula again:
\[ W = kA \]
Substituting \( A = 25 \) teaspoons and \( k = 0.5 \):
\[ W = 0.5 \cdot 25 = 12.5 \]
Thus, the amount of water needed for 25 teaspoons of ammonia is:
\[ \boxed{12.5} \] gallons.