Since the mass and weight vary directly, they are linked by an expression like

where w is the weight, m is the mass and k is the constant which gives the proportion.
Approach 1:
We may deduce the value of k from the first example: if 5kg weight 20N, then

And once k is known, solve the second example for m:

Approach 2:
Since the two quantity vary directly, they are in proportion. So, we can write a proportion like
mass1 : weight1 = mass2 : weight2
and solve it for mass2:

Of course, both approaches give the same result.