You can use 'arrayfun' in combination with 'cell2mat':
B = cell2mat(arrayfun(@(x,y) ones(y,1)*x, A(:,1), A(:,2), 'uniformoutput', false))'
This results in
B =
Columns 1 through 16
1 1 1 1 1 1 2 2 3 3 3 3 3 3 3 3
Columns 17 through 20
4 5 5 5