This is a Pathfinder Second Edition question.
Let's say that we have a fourth-level cleric who has taken Wizard Dedication and Basic Wizard Spellcasting (both CRB pg. 231) at second and fourth levels respectively. This character has second-level spell slots they can use for divine spells because they are a cleric and one first-level spell slot they can use for an arcane spell from Basic Wizard Spellcasting.
They acquire a Staff of Fire (CRB pg. 594), which can be used to cast burning hands. Burning hands is on their spell list because they have access to arcane spells from Wizard Dedication, and so they can Cast that Spell from the staff. The specific rule governing this is on CRB pg. 592:
You can Cast a Spell from a staff only if you have that spell on your spell list, are able to cast spells of the appropriate level, and expend a number of charges from the staff equal to the spell's level.
Because they can Cast some Spell from it, they can prepare the staff when they perform their daily preparations and imbue it with some charges. Here's the relevant rule from the same page:
During your daily preparations, you can prepare a staff to add charges to it for free. When you do so, that staff gains a number of charges equal to the highest level of spell you're able to cast. [...] You can prepare a staff only if you have at least one of the staff's spells on your spell list.
The question is, how many charges does the staff gain? One charge, because they can only cast first-level spells from the spell list that lets them use and prepare the staff? Or two charges, because they are strictly able to cast second-level spells?
Follow-up question: What if they didn't have Basic Wizard Spellcasting?