Either will work. However, you may find it easier to stain the pieces of the pergola while they are on the ground rather than waiting until the whole thing is assembled.